<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>添加-在线相册信息管理</title>
	<script type="text/javascript" src="./static/js/jquery-1.8.2.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#reset').click(function(){
				$('#show').attr('src','./static/pics/error.png');
			});
		});
	</script>
</head>
<body bgcolor="#02326B" link="balck" alink="red" vlink="black">
	<center>
		{% include 'myphoto/menuphoto.html'%}
		<form action="{% url 'insertphoto'%}" method="post" enctype="multipart/form-data">
			{% csrf_token %}
			<table>
				<tr>
					<td>标题：</td>
					<td><input type="text" name="title"></td>
				</tr>
				<tr>
					<td>图片：</td>
					<td>
						<input id="file" class="filepath" onchange="changepic(this)" type="file" accept="image/*" name="pic">
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<input type="submit" value="上传">
						<input id="reset" type="reset" value="重置">
					</td>
				</tr>
			</table>
		</form>
		<img id="show" width="200" src="./static/pics/error.png">
		<script>
			function changepic() {
				var reads= new FileReader();
				f=document.getElementById('file').files[0];
				reads.readAsDataURL(f);
				reads.onload=function (e) {
					document.getElementById('show').src=this.result;
				};
			}
		</script>
		<br><hr>
	</center>
</body>
</html>